import {MainData, PK, pkType} from "./BaseData";
import {field} from "./DataLoader";
import {dataClass} from "../managers/DataManager";
import {BaseRepository, getRepository, repository} from "./BaseRepository";
import {Constructor} from "../../../utils/BaseContext";

@dataClass("AppConfig")
export class AppConfig extends MainData {

  @field(Number)
  public inviteScore = 50;
  @field(String)
  public shopQRCode;
  @field(String)
  public studyQRCode;
  @field(String)
  public studyAvatar;

  @field(Boolean)
  public enableCheck = false;
  @field(String)
  public officialPhone = "123456789";

  @field(Boolean)
  public enable: boolean = true;
}

export function appConfigRepo() {
  return getRepository(AppConfigRepo);
}

@repository
export class AppConfigRepo extends BaseRepository<AppConfig> {

  get clazz(): Constructor<AppConfig> { return AppConfig; }
  public constructor() { super(); }

  get data() { return this.list[0]; }

}

